#include <iostream>
#include "LinkNode.hpp"
#include "LinkList.hpp"
int main() {
    LinkList<int> l;
    int position = 0, value = 0, n = 0;
    bool flag = false;

    cout << "请输入需要创建单向链表的结点个数：";
    cin >> n;
    l.CreateLinkList(n);

    cout << "打印链表值如下：";
    l.TraverseLinkList();

    cout << "请输入插入结点的位置和值：";
    cin >> position >> value;
    l.insert(position, value);

    cout << "打印链表值如下：";
    l.TraverseLinkList();

    cout << "请输入要删除结点的位置：";
    cin >> position;
    l.Delete(position);
    cout<<"为链表后添加一个新的节点8"<<"\n";
    l.append(8);
    l.TraverseLinkList();


    l.clear();
    flag = l.isEmpty();
    if (flag)
        cout << "删除链表成功！" << endl;
    else
        cout << "删除链表失败！" << endl;

    return 0;
}